package zhanglu.family.socket.demo.busdemo.server;

import org.apache.log4j.PropertyConfigurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import zhanglu.family.socket.textline.factory.INetSocketFactory;
import zhanglu.family.socket.textline.factory.impl.NetSocketFactory;
import zhanglu.family.socket.textline.server.BaseTCPServer;

/**
 * 服务总线
 * 
 * @author zhanglu
 * @date 2017年3月10日
 */
public class BusServer {
    private static Logger            logger  = LoggerFactory.getLogger(BusHandler.class);

    private static Integer           port    = 8888;                                     // 服务端口

    private static INetSocketFactory factory = new NetSocketFactory();                   // 获取实例工厂

    public static void main(String[] args) {
        PropertyConfigurator.configure("log4j.properties");

        BaseTCPServer server = factory.getBaseTCPServer(port);
        boolean ok = server.startServer(new BusHandler());
        if (ok) {
            logger.info("服务端启动，端口为：" + port);
        }
    }
}
